import request from '@/utils/request';

interface BannerItem {
  bannerId: string;
  serNum: number;
  picUrl: string;
}

interface ListResponse {
  list: BannerItem[];
  total: number;
}

export async function qryTopBannerListPage(params: {
  pageIndex?: number;
  pageSize?: number;
}): Promise<ListResponse> {
  const response = await request('/banner/qryTopBannerListPage', {
    method: 'POST',
    data: params,
  });
  return {
    list: response.data || [],
    total: response.total || 0,
  };
}

export async function addTopBannerPic(params: {
  serNum: number;
  picUrl: string;
}): Promise<void> {
  await request('/banner/addTopBannerPic', {
    method: 'POST',
    data: params,
  });
}

export async function updateTopBannerPic(params: {
  bannerId: string;
  serNum: number;
  picUrl: string;
}): Promise<void> {
  await request('/banner/updateTopBannerPic', {
    method: 'POST',
    data: params,
  });
}

export async function deleteTopBannerPic(params: {
  bannerId: string;
}): Promise<void> {
  await request('/banner/deleteTopBannerPic', {
    method: 'POST',
    data: params,
  });
}